pp108 : Prefilling List and Select Controls

Prefilling List and Select Controls

This topic describes the procedure to prefill List and Select controls.

You can use the Select and List controls to input data on an application page (XForm). These controls can display multiple input values, from which you can select the appropriate option as the input. The multiple options that display in the Select and List controls can be defined manually or retrieved for display from the backend (for example, from a database). Using the controls' property sheets, you can prefill these controls either manually or from the backend, as required.

Each option displayed in the controls is associated with a description and a value. The description of the option displays in the controls at run time, while the value of the option refers to the actual value to which the description is mapped internally. The value is not visible at run time and is only used in the backend. When prefilled from the backend, description and value refer to business object nodes of the dataset used.

The procedure to prefill both the Select and List controls is similar.

  1. Open the XForm in the XForms Designer.
  2. Double-click the control displayed in the Designer Area. The <control name> window appears in the XForms Designer.
  3. Click in the Dataset field. The Pre-fill data source for <control> dialog box appears.
  4. Select an option from the Dataset Source drop-down list:
    • Select Existing Model to prefill the control using an existing model in the XForm.
    • Select Custom Content to manually define the options with which to prefill the control.Depending on the option you select, the Existing Model or Custom Content area displays in the Pre-fill data source for <control> dialog box.
  5. Make appropriate modifications:
    • In the Existing Model area, you can define the dataset to prefill the control. At run time, the specified model fetches the data from the dataset and prefills the control.
      • Select an option from the Model drop-down list to specify the model from which to prefill the control.

        Note:
        Ensure that you do not select the model specified in the Model field of the <control > dialog box.

      • If the existing models are not suitable, click from the Model drop-down list to create a model. The Model Properties dialog box appears, where you can define the new model.
      • Click for the Node Set field to display the Model References dialog box. Select the appropriate option and click OK to display it in the Node set field. This field is optional and corresponds to thesReference|initialize()|parameter of the initialize() method used to programmatically prefill the control. At run time, the selected node is used as the starting point for data references, that is, the control is prefilled using the constituent nodes under the selected node.
      • Click for the Description field to display the Model References dialog box. Select the appropriate option and click OK to display it in the Description field. At run time, values from the selected node are prefilled as descriptions in the control.
      • Click for the Value field to display the Model References dialog box. Select the appropriate option and click OK to display it in the Value field. At run time, values from the selected node are prefilled as values in the control.
    • In the Custom Content area, you can manually specify the options with which to prefill the controls at run time.
      • Click to display an empty row, and type the description and value of the option under the Description and Value columns, respectively.
      • Select the description and value of an option and click to delete it.
  6. Click OK in the Pre-fill data source for <control> dialog box.

This saves the prefilling settings to be used for the control at run time.

Note:
You must use the initialize() method to manually prefill the Select and List controls with non-transactional or complex transactional data (containing multiple levels of nodes).